{include file="public/header" /}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.css"}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.js"}
<style>
    #des, #des input {
        width: 40px;
        text-align: center;
    }

    #id {
        width: 78px;
    }

    .bs-checkbox {
        width: 36px;
        height: 40px
    }

    .fixed-table-toolbar .columns, .fixed-table-toolbar .search {
        margin-left: 0px;
        margin-top: 0px
    }

    #title span {
        float: right;
    }

    .asdlkjasd {
        background: #1ab394;
        color: #fff
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content {:config('adminClass.main')}">
    <div class="ibox float-e-margins">
        {include file="public/tophead"}
        {include file="public/top" /}
        <div class="ibox-content">
            {include file="public/topsection"}
            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="fixed-table-toolbar">
                        <!--<a class="btn btn-default btn-outline {eq name='paymethod' value='0'}asdlkjasd{/eq}" href="{:url('withdraw',['paymethod' => 0])}{present name='state'}/state/{$state}{/present}">微信</a>-->
                        <a class="btn btn-default btn-outline {eq name='paymethod' value='1'}asdlkjasd{/eq}" href="{:url('withdraw',['paymethod' => 1])}{present name='state'}/state/{$state}{/present}">支付宝</a>
                    </div>
                    <div class="fixed-table-toolbar">
                        <a class="btn btn-default btn-outline {eq name='state' value='0'}asdlkjasd{/eq}" href="{:url('withdraw',['state' => 0, 'money' => $money,'paymethod'=>$paymethod])}">审核</a>
                         <a class="btn btn-default btn-outline {eq name='state' value='1'}asdlkjasd{/eq}" href="{:url('withdraw',['state' => 1, 'money' => $money,'paymethod'=>$paymethod])}">通过</a>
                        <a class="btn btn-default btn-outline {eq name='state' value='2'}asdlkjasd{/eq}" href="{:url('withdraw',['state' => 2, 'money' => $money,'paymethod'=>$paymethod])}">拒绝</a>

                        <a style="margin-left:50px;" >总提现: <font color="#1ab394" style="font-size: 18px;margin-right: 10px">{$withdrawsum}</font>提现笔数: <font color="#1ab394" style="font-size: 18px;margin-right: 10px">{$withdrawcount}</font>{eq name='paymethod' value='0'}分裂后笔数: <font color="#1ab394" style="font-size: 18px;">{$withdrawcount2}</font>{/eq}</a>
                        <!--<a style="margin-left:50px;" class="btn btn-default btn-outline {eq name='money' value='0'}asdlkjasd{/eq}" href="{:url('withdraw',['money' => 0, 'state' => $state])}">全部</a>-->
                        <!--<a class="btn btn-default btn-outline {eq name='money' value='1'}asdlkjasd{/eq}" href="{:url('withdraw',['money' => 1, 'state' => $state])}">100元以下</a>-->
                        <!--<a class="btn btn-default btn-outline {eq name='money' value='2'}asdlkjasd{/eq}" href="{:url('withdraw',['money' => 2, 'state' => $state])}">100~299</a>-->
                        <!--<a class="btn btn-default btn-outline {eq name='money' value='3'}asdlkjasd{/eq}" href="{:url('withdraw',['money' => 3, 'state' => $state])}">300~599</a>-->
                        <!--<a class="btn btn-default btn-outline {eq name='money' value='4'}asdlkjasd{/eq}" href="{:url('withdraw',['money' => 4, 'state' => $state])}">600~999</a>-->
                        <!--<a class="btn btn-default btn-outline {eq name='money' value='5'}asdlkjasd{/eq}" href="{:url('withdraw',['money' => 5, 'state' => $state])}">1000元以上</a>-->
                    </div>
                    <div style="display:block;clear: both;"></div>
                    <div class="fixed-table-toolbar">
                        <form  method="get" action="" style="display: flex;">
                            <div class="pull-left search" style="display: flex;">
                                <div class="columns columns-right btn-group pull-left">
                                    <select class="form-control" name="search">
                                        <option value="id" {php}if(input('?param.search')){if(input('param.search')=='id'){echo "selected";} }{/php}>会员ID</option>
                                        <option value="name" {php}if(input('?param.search')){if(input('param.search')=='name'){echo "selected";} }{/php}>昵称</option>
                                    </select>
                                </div>
                                <div class="pull-right search">
                                    <input class="form-control input-outline" type="text"
                                           {php}
                                           if(input('?param.name')){
                                    if(input('param.name')){
                                    echo "value='".input('name')."'";
                                    }

                                    }
                                    {/php}
                                    name="name" placeholder="搜索">
                                </div>

                                <div class="pull-right search">
                                    <button style="border-radius:0px; border:1px solid #e5e6e7; border-left:0px" class="btn btn-default btn-outline" type="submit">搜索</button>
                                </div>

                                {php}
                                if(input('?param.name')){
                                {/php}
                                <div class="pull-right search">
                                    <a class="btn btn-w-m btn-link" href="{:url('withdraw')}">返回列表</a>
                                </div>{php}
                                }
                                {/php}
                            </div>
                        </form>
                    </div>
                    <div class="example">
                        <form class="form-horizontal" method="post">
                            <table data-toggle="table">
                                <thead>
                                <tr>
                                    <th class="bs-checkbox"><input type="checkbox" id="delidAll"></th>
                                    <th data-align="center">昨日零时积分</th>
                                    <th data-align="center">昨日积分收入</th>
                                    <th data-align="center">今日零时积分</th>
                                    <th data-align="center">用户</th>
                                    <th data-align="center">昨日提现总额</th>

                    {if condition="$admin.type == 1"}
                                    {eq name='state' value='0'}
                                    <th data-align="center">管理</th>
                                    {/eq}
                    {/if}
                                </tr>
                                </thead>
                                <tbody id="form">
                                {volist name="data" id="v"}
                                <tr class="class">
                                    <td id="delid" ><input name="delAll[]" type="checkbox" value="{$v.userid}"></td>
                                    <td>{$v.score_yesterday}</td>
                                    <td><a onclick="income('{$v.userid}')" style="color:#40BCF7">{$v.income_yesterday}</a></td>
                                    <td>{$v.score_today}</td>
                                    <td><a onclick="member('{$v.userid}')" style="color:#40BCF7">{$v.name}</a><br/>({$v.userid})</td>
                                    <td><a onclick="detail('{$v.userid}', '{$state}')" style="{$v.warn ? 'color:red':'color:#40BCF7'}">{$v.money}</a></td>
                    {if condition="$admin.type == 1"}
                                    {eq name='state' value='0'}
                                    <td>
                                        <div class="btn-group">
                                            <div data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle">
                                                操作 <span class="caret"></span>
                                            </div>
                                            <ul class="dropdown-menu">
                                                <li><a onClick="add('{:url('allWithdraw',['user_id'=>$v['userid'],'url'=>-1])}')">批量审核</a></li>
                                            </ul>
                                        </div>
                                    </td>
                                    {/eq}
                    {/if}
                                </tr>
                                {/volist}
                                </tbody>
                            </table>
                        </form>
                    </div>
                </div>
            </div>
            <hr>
            <hr>
            <div class="row row-lg">
                <div class="col-sm-6">
                    {if condition="$admin.type == 1"}
                    <div  class="btn btn-outline btn-default" onclick="exportWithdrawMerge(0)">
                        <!--导出已合并未提现的数据-->
                        批量导出
                    </div>
                    <div  class="btn btn-outline btn-default" onclick="alla(1)">
                        批量通过
                    </div>
                    {/if}
                    <!-- <div  class="btn btn-outline btn-default" onclick="alla(2)">
                        批量拒绝
                    </div> -->
                    <a href="?order=1" type="button" class="btn btn-outline btn-default">
                        倒序排序
                    </a>
                    <a href="?order=2" type="button" class="btn btn-outline btn-default">
                        顺序排序
                    </a>
                </div>
                <div class="col-sm-12 pages">{$page}</div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}

<script type="text/javascript">
$(document).ready(function(){
        $('#delidAll').click(function(){
            $('input[type=checkbox]').each(function(){
                var self=$(this);
                if(!self.prop('checked')){
                    self.prop('checked',true);
                }else{
                    self.prop('checked',false);
                }
            });
        })
});
    function member(id)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("member/index")}?search=id&name='+id
            });
        });
    }
function alla(types){
    var all=$(".form-horizontal").serialize();
    var alls=$(".form-horizontal").serializeArray();
    console.log(JSON.stringify(alls))

    ajaxFun("post",'{:url('shenheAll')}?type='+types,all,'json',function(ret){

        if(ret){
            setTimeout(()=>{
                window.location.href = window.location
            },1000)

            swal_msg(ret.ret ? ret.ret : ret.err)
        }
    })

}
 

    function detail(id, state)
    {
        var type = Number(state) + 3;
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("tixian")}?search=id&yesterday=1&name='+id
            });
        });
    }
    function exportWithdrawMerge(sex) {
        window.location.href = ('{$paymethod}' == 0 ? '{:url("Export/WithdrawMergeWechat")}':'{:url("Export/WithdrawMerge")}') + '?money={$money}&order={$order}';
    }

    function income(id)
    {
        var start = "{$start}"
        var end = "{$end}"

        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("shouyi/records")}?search=id&name='+id + '&start=' + start + '&end=' + end
            });
        });
    }

</script>
 